package com.wx.wugl.service.impl;

import com.wx.wugl.entity.EmArchivesEntity;
import com.wx.wugl.mapper.EmArchivesMapper;
import com.wx.wugl.service.EmArchivesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wx.wugl.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhang
 * @since 2021-05-31
 */
@Service
public class EmArchivesServiceImpl extends ServiceImpl<EmArchivesMapper, EmArchivesEntity> implements EmArchivesService {

    @Autowired
    private EmArchivesMapper emArchivesMapper;

    @Override
    public List<EmArchivesEntity> findAll(EmArchivesEntity emArchivesEntity) {

        List<EmArchivesEntity> emArchivesEntityList = emArchivesMapper.findAll(emArchivesEntity);
        return emArchivesEntityList;
    }

    @Override
    public int add(EmArchivesEntity emArchivesEntity) {
        if (emArchivesEntity.getId() == null){
            emArchivesEntity.setId(UUIDUtil.getUUID());
        }
        return emArchivesMapper.add(emArchivesEntity);
    }

    @Override
    public int update(EmArchivesEntity emArchivesEntity) {
        return emArchivesMapper.update(emArchivesEntity);
    }

    @Override
    public int deleteById(String id) {
        return emArchivesMapper.deleteById(id);
    }

    @Override
    public EmArchivesEntity findById(String id) {
        return emArchivesMapper.selectById(id);
    }
}
